package proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * describe:
 *
 * @author huxingjie
 * @date 2020/04/28
 * @since 4.0
 */
public class JDKProxy implements InvocationHandler {
    private Person person;

    public JDKProxy(Person person) {
        this.person = person;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("invoke before");
        Object invoke = method.invoke(person, args);
        System.out.println("invoke after");
        return invoke;
    }
}

